home *** CD-ROM | disk | FTP | other *** search
- /* searchpath function from page 383 of turbo c bible */
- #include<stdio.h>
- #include<dir.h>
- main(int argc, char **argv)
- {
- char *path_buffer;
- printf("this program searches for a file in all \n\
- the directories specified in the path\n\
- environment variable\n");
- if(argc < 2)
- {
- printf("Usage: %s <filename>\n", argv[0]);
- exit(0);
- }
- path_buffer = searchpath(argv[1]);
- if(path_buffer == NULL)
- printf("file: %s not found\n",argv[1]);
- else
- printf("found as: %s\n", path_buffer);
- }